feat: add idle state handling to movement state logic - #382
Conversation
WalkthroughThis update implements explicit handling for the actor's idle state. In the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant MS as MovementState
participant ET as EmoteTask
C->>MS: Call KeyframeEvent(keyName)
alt ActorState.Idle
MS->>MS: Call StateEmoteEvent(keyName)
else Other State
MS->>MS: Process other state event
end
C->>MS: Call Update(tickCount, tickDelta)
alt ActorState.Idle
MS->>MS: Call EmoteStateUpdate(tickCount, tickDelta)
end
C->>ET: Call Emote(isIdle)
alt isIdle true
ET->>ET: Set actor state to Idle
else isIdle false
ET->>ET: Set actor state to Emotion
end
sequenceDiagram
participant NPC as FieldNpc
participant MS as MovementState
NPC->>NPC: Animate(sequenceName)
NPC->>NPC: Check for "idle" in sequenceName
NPC->>MS: Call TryEmote(isIdle)
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code Definitions (2)Maple2.Server.Game/Model/Field/Actor/FieldNpc.cs (3)
Maple2.Server.Game/Model/Field/Actor/ActorStateComponent/MovementStateTasks/MovementState.EmoteTask.cs (2)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| } | ||
|
|
||
| idleTask = MovementState.TryEmote(sequence.Name, false, duration); | ||
| bool isIdle = sequenceName.Contains("idle", StringComparison.OrdinalIgnoreCase); |
There was a problem hiding this comment.
I'm a little on the fence about blanket calling animations with idle in the name an idle task, behavior-wise, but it is worth a shot. If it breaks anything we can take a closer look when we discover it.
Summary by CodeRabbit